<?php
//  防止全局变量造成安全隐患
$admin = false;
//  启动会话，这步必不可少
@session_start();
//  判断是否登陆
if (isset($_SESSION["admin"]) && $_SESSION["admin"] === true) {


?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>14计算机1班年龄登记系统</title>
<script src="js/jquery-1.8.2.min.js" type="text/javascript"></script>
<script>
$(function() {
  $(".dl").click(function(){
  		return confirm( "确定删除吗？");
  });
 　
});
</script>
<style type="text/css">
.main {

	font-size:20px;
}
body h1 {
	text-align: center;
}
.in{
	width: 400px;
	height: 30px;
}
.in1{
	width: 800px;
	height: 30px;
}
.name{
	height: 30px;
}
span{
	color: #FD3F42;
	
}
.btn{
	font: normal 16px/1 \5FAE\8F6F\96C5\9ED1;
	margin: 2px 20px;
	padding: 2px;
	cursor: pointer;
	width: 200px;
	height: 40px;
	
}
</style>
</head>

<body>
<h1>敏捷在线报名记系统</h1>


<input   type= "button" value= "打印报名表"  onclick="location.href='print.php';"/>
<input   type= "button" value= "返回报名首页"  onclick="location.href='../index.php';"/>
<input   type= "button" value= "退出系统"  onclick="location.href='tuichu.php';"/>

<div class="main">
<!--<form action="addname.php" method="post" autocomplete="off">
姓名：<input name="name" class="name" type="text" required="required"  /><br />
<br />
年龄：<input name="age" class="name" type="text" required="required" /><br />
<input type="password" style="display:none">


<input class="btn" name="Button" type="submit" value="添加" />
<input class="btn" type="reset" value="重置" />
<input name="add" type="hidden" value="ok" />

</form>-->





<br />
<?php
   
//将数据表students显示   select
     //连接数据库
      /*$con=@mysql_connect(SAE_MYSQL_HOST_M.':'.SAE_MYSQL_PORT,SAE_MYSQL_USER,SAE_MYSQL_PASS);
	  
	   mysql_select_db(SAE_MYSQL_DB,$con);//选择数据库
	   mysql_query("set names utf8");*/
	   include"conn.php";
       $str="select * from mj order by id asc";
	   $result=mysql_query($str,$conn);//查询结果要用变量来保存

	  echo  '<table border="1" style="text-align: center;" cellspacing="1" cellpadding="1">';
	  echo  '<caption>报名列表</caption>';
	  echo  '<tr>
	  			<th width="40px" scope="col">序号</th> 
			  	<th width="120px" scope="col">姓名</th>   
				<th width="200px" scope="col">班级</th>
				<th width="150px"scope="col">手机号码</th>
				<th width="120px"scope="col">QQ</th>
				<th scope="col">你学习过编程吗？</th>
				<th scope="col">你是否有一手比较精通或者熟练的技术？</th>
				<th scope="col">你为什么要加入本协会？</th>
				<th scope="col">报名时间</th>
				<th width="50px"scope="col">操作</th>
			</tr>';
			$i=1;
			while($row=mysql_fetch_array($result))
			{
				
				
				
				echo "<tr>";
				  echo "<td>";
				  echo $i++;
				  echo "</td>";
				  echo "<td>";
				  echo htmlspecialchars($row['name']);
				  echo "</td>";
				  echo "<td>";
				  echo htmlspecialchars($row['classname']);
				  echo "</td>";
				  echo "<td>";
				  echo htmlspecialchars($row['phone']);
				  echo "</td>";
				  echo "<td>";
				  echo htmlspecialchars($row['qq']);
				  echo "</td>";
				  echo "<td>";
				  echo htmlspecialchars($row['study']);
				  echo "</td>";
				  echo "<td>";
				  echo htmlspecialchars($row['technology']);
				  echo "</td>";
				  echo "<td>";
				  echo htmlspecialchars($row['why']);
				  echo "</td>";
				  echo "<td>";
				  echo htmlspecialchars($row['etime']);
				  echo "</td>";
                  echo "<td>";
				  echo "<a class='dl' href='delete.php?sid={$row['id']}' >删除</a>";
				  echo "</td>";
				 echo "</tr>";
			}
	  echo  '</table>';
	  mysql_close($conn);
?>
  </div> 
  <?php
} else {
    //  验证失败，将 $_SESSION["admin"] 置为 false
    $_SESSION["admin"] = false;
    die( "<script>location.href='login.php';</script>");
}

?>
</body>
</html>
